<!--
 * @Author: 张瑞
 * @Date: 2021-08-31 16:38:51
 * @LastEditors: huangl
 * @LastEditTime: 2022-01-11 11:16:51
 * @Description: file content
 * @FilePath: \vue2xComponents\src\modules\demo\views\cbA\cp3\cp3.vue
-->
<template>
  <div>
    <div>
      <button @click="change">切换语言</button> 当前语言: {{ $i18n.locale }}
    </div>
    {{ $t("message.hello") }}
  </div>
</template>
<script>
export default {
  data() {
    return {
      lang: true,
    };
  },
  methods: {
    change() {
      this.lang = !this.lang;
      this.$i18n.locale = this.lang ? "en-US" : "zh-CN";
    },
  },
};
</script>
<style lang="">
</style>